<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>业务数据</title>
</head>
<body>
	<div style="margin:25px;">
	
		<form action="checkCountByStageByYearAndMonth.do" method="post" onsubmit="return checkTime()">
			请选择开始日期:<input type="text" name="begintime" id="begintime" readonly="readonly" onclick="WdatePicker()">
			请选择结束日期:<input type="text" name="endtime" id="endtime" readonly="readonly" onclick="WdatePicker()">
			<input type="submit" value="查询">
			<div class="detail-section">
		    	<div id="canvas"></div>
			</div>
		</form>	
	</div>
	          		
<script type="text/javascript" src="calendar/WdatePicker.js"></script>
<script src="http://g.tbcdn.cn/bui/acharts/1.0.32/acharts-min.js"></script>
<script src="js/jquery-2.1.1.js"></script>
<script type="text/javascript">   
		
  //验证日期（判断结束日期是否大于开始日期）日期格式为YY—MM—DD
  function checkTime(){             
  		var beginTime=$("#begintime").val();
  		var endTime=$("#endtime").val();
  		if(beginTime == "") {
  		    alert("开始时间不能为空");
  		    return false;
  		}
  		if(endTime == "") {
  		    alert("结束时间不能为空");
  		    return false;
  		}
  		var t1 = beginTime.replace("/"," ");
  	    var t2 = endTime.replace("/"," ");
  	    var   date1   =   new   Date(t1.replace("-","/"));
  	    var   date2   =   new   Date(t2.replace("-","/"));
  	    var   n     =   date1.getTime()   -   date2.getTime();
  	    if(!(n<0)){
  	  	  alert("结束时间要晚于开始时间");
  	   	  return false;
  	    }
  	    return true;
	}  
  
  var chart = new AChart({
		theme : AChart.Theme.Smooth2,
		id : 'canvas',
		width : 950,
		height : 400,
		xAxis : {
			type : 'category'
		},
		seriesOptions : {
			columnCfg : {
				allowPointSelect : true,
				xField : 'x',
				item : {
						cursor : 'pointer',
						stroke : 'none'
				}
			}
		},
		yAxis : {
			min : 0
		},
		series: [ {
			name: '销售形势预测',
			events : {
				itemclick : function (ev) {
					var point = ev.point,
						//item = ev.item, //点击的项
						obj = point.obj; //point.obj是点击的配置项的信息
						alert(obj.x); //执行一系列操作
				},
			},       
			data: [
					{x : '初步接洽', y : ${stageOne},	attrs : {fill : '#7179cb'}},
					{x : '需求确定', y : ${stageTwo},	attrs : {fill : '#79c850'}},
					{x : '方案/报价',y : ${stageThree},attrs : {fill : '#ffb65d'}},
					{x : '谈判/合同',y : ${stageFour}, attrs : {fill : '#6ed7ff'}},
					{x : '赢单数量', y : ${stageFive},	attrs : {fill : '#cd5c5c'}},
			]      
		}] 
	});
	chart.render();

	
	
	
</script>
</body>

</html>